package com.yonyougov.devops.cruxcisupport.util;

import com.yonyougov.devops.cruxcisupport.enums.BaseEnum;

public class EnumUtil {

public static <T extends BaseEnum> String getValueByCode(Integer code, Class<T> enumClass) {
    //通过反射取出Enum所有常量的属性值
    for (T each: enumClass.getEnumConstants()) { 
    //利用code进行循环比较，获取对应的枚举
    if (code.equals(each.getCode())) {
    return each.getValue();
    }
}
return null;
    }
}
